|
1
|
|
|
import { Border } from '../../../controls'; |
|
2
|
|
|
|
|
3
|
|
|
describe( 'Border Control', function() { |
|
4
|
|
|
let $target = $( '<div>' ), |
|
5
|
|
|
border = new Border( { target: $target } ), |
|
6
|
|
|
$control = border.render(); |
|
7
|
|
|
|
|
8
|
|
|
it( 'creates html', function() { |
|
9
|
|
|
expect( !! $control.html().length ).toEqual( true ); |
|
10
|
|
|
} ); |
|
11
|
|
|
|
|
12
|
|
|
it( 'refreshes values', function() { |
|
13
|
|
|
$target.css( 'border', '' ); |
|
14
|
|
|
border.refreshValues(); |
|
15
|
|
|
expect( border.getValues() ).toEqual( { top: 0, right: 0, bottom: 0, left: 0 } ); |
|
16
|
|
|
$target.css( 'border', '1px solid green' ); |
|
17
|
|
|
border.refreshValues(); |
|
18
|
|
|
expect( border.getValues() ).toEqual( { top: 1, right: 1, bottom: 1, left: 1 } ); |
|
19
|
|
|
} ); |
|
20
|
|
|
|
|
21
|
|
|
it( 'shows border width', function() { |
|
22
|
|
|
$target.css( 'border', '2px dashed green' ); |
|
23
|
|
|
border.refreshValues(); |
|
24
|
|
|
expect( border.$typeControl.find( '.slider-group' ).css( 'display' ) ).toEqual( 'block' ); |
|
25
|
|
|
} ); |
|
26
|
|
|
|
|
27
|
|
|
it( 'returns border-style', function() { |
|
28
|
|
|
$target.css( 'border', '' ); |
|
29
|
|
|
$target.css( 'border-bottom', '2px dashed green' ); |
|
30
|
|
|
border.refreshValues(); |
|
31
|
|
|
expect( border._getBorderStyle() ).toEqual( 'dashed' ); |
|
32
|
|
|
expect( border.$typeControl.find( '.slider-group' ).css( 'display' ) ).toEqual( 'block' ); |
|
33
|
|
|
} ); |
|
34
|
|
|
|
|
35
|
|
|
it( 'hides border width', function() { |
|
36
|
|
|
$target.css( 'border', '2px dashed green' ); |
|
37
|
|
|
border.refreshValues(); |
|
38
|
|
|
$target.css( 'border', '' ); |
|
39
|
|
|
border.refreshValues(); |
|
40
|
|
|
expect( border.$typeControl.find( '.slider-group' ).css( 'display' ) ).toEqual( 'none' ); |
|
41
|
|
|
} ); |
|
42
|
|
|
} ); |
|
43
|
|
|
|